<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页</title>
</head>

<body>
    <table>
        <input type="text" id="text" placeholder="请输入查找内容">
        <input type="button" value="搜索" onclick="Query()">
        <input type="button" value="添加" onclick="Insert()">
        <tr>
            <th>ID</th>
            <th>ProductName</th>
            <th>Price</th>
            <th>操作</th>
        </tr>
    </table>

    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="./js/fn.js"></script>
    <script>
        $(function () {
            $.get('http://localhost:8080/product', function (res) {
                let tb = $('table');
                res.forEach(item => {
                    tb.append(`
                        <tr>
                            <td>${item.id}</td>
                            <td>${item.productname}</td>
                            <td>${item.price}</td>
                            <td>
                                <input type="button" value="修改" onclick="Update(${item.id})">
                                <input type="button" value="删除" onclick="Delete(${item.id})">
                            </td>
                        </tr>
                    `)
                });
            });
        })

    </script>
</body>

</html>